package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.query.QuestionAdminPageQuery;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author Aimer
 * @since 2025-11-10
 */
@RestController
@RequestMapping("/admin/questions")
@Api(tags = "问题模块(管理端)")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService iInteractionQuestionService;

    @ApiOperation(("分页查询提问信息(管理端)"))
    @GetMapping("/page")
    public PageDTO<QuestionAdminVO> pageAdminQuestions(QuestionAdminPageQuery questionPageQuery){
        return iInteractionQuestionService.pageAdminQuestions(questionPageQuery);
    }

    @ApiOperation("管理端隐藏或显示问题")
    @PutMapping("/{id}/hidden/{hidden}")
    public void updateHiddenStatus(@PathVariable Long id ,@PathVariable Boolean hidden){
        iInteractionQuestionService.updateHiddenStatus(id,hidden);
    }

    @ApiOperation("管理端根据id查询问题详情")
    @GetMapping("/{id}")
    public QuestionAdminVO AdminGetByQuestion(@PathVariable Long id){
       return iInteractionQuestionService.AdminGetByQuestion(id);
    }
}
